package org.gg.boom.modules.schedule.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.gg.boom.common.model.Response;
import org.gg.boom.modules.schedule.model.dto.ScheduleJobLogDTO;
import org.gg.boom.modules.schedule.service.ScheduleJobLogService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * 定时任务日志
 */
@RestController
@RequestMapping("/sys/scheduleLog")
@RequiredArgsConstructor
public class ScheduleJobLogController {

    private final ScheduleJobLogService scheduleJobLogService;

    /**
     * 分页
     *
     * @param params
     * @return
     */
    @GetMapping("page")
    public Response page(@ApiIgnore @RequestParam Map<String, Object> params) {
        Page<ScheduleJobLogDTO> page = scheduleJobLogService.page(params);
        return Response.success();
    }

    /**
     * 信息
     *
     * @param id
     * @return
     */
    @GetMapping("{id}")
    public Response info(@PathVariable("id") Long id) {
        ScheduleJobLogDTO log = scheduleJobLogService.get(id);
        return Response.success(log);
    }
}
